<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// 
//  fetch.php
//  www.6block.com
//  
//  Created by Will_Lee on 2011-06-02.
//  Copyright 2011 lishuzu. All rights reserved.
// 
/*
*抓取数据
*/
class Cron_6block extends CI_Controller {

	 function __construct()
	 {
		parent::__construct();
		$this->load->database();
	 }

	 function downindexs_batch()
	 {

		//设置不超时，关闭浏览器继续执行
		ignore_user_abort(true);
		set_time_limit(0);
		$this->load->model('activity_model', '', TRUE);		
		$this->db->where('endtime <=', now());
		$this->db->where('status', '0');
		$query = $this->db->get("activity");
		foreach ($query->result_array() as $row) {
			$ids[] = $row['aid'];
		}
		$result = $this->activity_model->downindexs($ids);
		if ($result) {
			echo '批量下架成功'.date('Y-m-d H:i:s', now());
		}else {
			echo '批量下架失败'.date('Y-m-d H:i:s', now());
		}
	 }
}
?>